<template>
	<view v-if='info' class="bg-white">
		<view class="title">
			{{info.title}}
		</view>
		<view class="time">
			发布于 {{info.create_time}}
		</view>
		<view class="content">
			<u-parse :html="info.content"></u-parse>
		</view>
	</view>
</template>

<script>
	import {
		getAdDetail
	} from '@/api/index';
	export default {
		data() {
			return {
				info: null
			};
		},
		onLoad(options) {
			this.getAdDetail(options.id);
		},
		methods: {
			async getAdDetail(id) {
				const res = await getAdDetail({
					id
				});
				const data = res.data;
				this.info = data;
				this.info.content = data.content.replace(/<img/g, '<img style="max-width:100%;height:auto;display:block;"');
			}
		},
	}
</script>

<style lang="scss" scoped>
	.title {
		padding: 10px 14px;
		font-size: 16px;
		color: #333;
		font-weight: bold;
	}

	.time {
		padding: 0 14px 10px;
		font-size: 10px;
		font-weight: 400;
		line-height: 14px;
		color: #808080;
	}

	.content {
		border-top: 1rpx solid #ECECEC;
		padding: 10px 14px;
		font-weight: 400;
		line-height: 17px;
		color: #666666;
	}
</style>
